-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IL2CPP compliant build for Unity #2044
base: master
Are you sure you want to change the base?
Conversation
Hey @jilleJr , great work on this feature - it's much needed for the project we're currently working on! Hey @JamesNK is there any update on whether this feature is planned to be merged into master? We're getting close to needing it for mobile deployment and it would be great to get the update through Nuget as opposed to managing a feature branch. Thanks! |
Yea well getting it in the actual releases would be grand. Maybe James isn't that active reading pull requests? For those waiting but could do with building it manually, you can just clone my branch https://github.com/jilleJr/Newtonsoft.Json#feature/unity-il2cpp-compiant (same as from this PR) and start building the code locally by just executing the git clone https://github.com/jilleJr/Newtonsoft.Json --depth 1 --single-branch --branch feature/unity-il2cpp-compiant
# executed inside folder
Build/localbuild.ps1 Followed by just navigating to the folder |
+1 |
This should in theory work for all IL2CPP configured builds, including standalone (Windows/OS X/Linux), WebGL, iOS, Android, UWP, etc. This new build configuration is good for all AOT compilations as well as some extra requirements needed for IL2CPP compilation. So far tested and confirmed working on standalone & WebGL builds |
Can has please! |
Would be great to have this pulled into master |
Newtonsoft.Json for Unity is now available as an Unity Package!https://github.com/jilleJr/Newtonsoft.Json-for-UnityFor convenience I've prepared a Unity Package you all can abuse your socks off. Installation via Unity Package Manager (UPM)
Open {
"scopedRegistries": [
{
"name": "Packages from jillejr",
"url": "https://npm.cloudsmith.io/jillejr/newtonsoft-json-for-unity/",
"scopes": ["jillejr"]
}
],
"dependencies": {
"jillejr.newtonsoft.json-for-unity": "12.0.101",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.cloth": "1.0.0",
"com.unity.modules.director": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0",
"// cropping rest of packages for readability"
}
} This project will live long for a while, so it's all safe to use. Now also featuring help from Dustin Horne (aka ParentElement himself) Note - far from aloneThere are plenty of projects that gives JSON parsing in Unity. However most of them seems to be discontinued:
While my repo will live for some time, for future reference here are some good alternatives (that all work in Unity) that I personally recommend if my solution dips below your expectations:
Happy Json parsing! |
@jilleJr I've added the package to my new Unity project (2018.4.4 but also 2019.1.11) but building fails. |
Super weird I did not find this before! Easily reproduced, even via local installation instead of UPM. It's like "worked on my machine a week ago". Don't know what could be different now. |
+1 It must have feature, Unity used wide novadays and has direct support will'b great |
Hey @JamesNK any hope to get this in the next release? It would be great to have Unity supported! Thank you |
Hello @jilleJr, So just change this line: |
Hey @JamesNK any hope to get this upstream? Having it support Unity would be really amazing for all of us! Thank you |
I installed the above-linked UPM package from @jilleJr and switched my Unity 2019.3.4f1 project's Windows build scripting backend from Mono to IL2CPP. My project was able to be built with Mono but not IL2CPP. I got some obscure compiler error message about JsonConvert.DeserializeObject having an extra character that it didn't expect, but my JSON was completely valid. From my research, I found and used the workaround in the following linked comment. I just placed the code in the following linked comment directly before my JsonConvert.DeserializeObject call and it worked. Azure/azure-iot-sdk-csharp#213 (comment) I'm not sure why. Maybe I am using an old version of the build chain or something. Anyway, maybe this will help someone who had the same issue later. Thanks to @jilleJr for this pull request and the Unity-compatible fork. I hope @JamesNK can merge this pull request soon, as I don't see a downside. Also thanks for the JSON tool. |
Hi @AlexFolland. This issue has had a lot of progress in the background by now. Here's the news:
There are some greater amount of work being put into making Newtonsoft.Json available to Unity (and particularly IL2CPP). I can only guess James' intention here being that he want to focus on supporting the .NET platform and let community around it make it available to other variants, as he seems to be putting less time into this project at the moment. Just merging this also makes him responsible for maintaining it and all of the sudden have to answer all Unity-specific questions. These are just speculations of course. Maybe @JamesNK can enlighten us with his intentions on this? |
Adds IL2CPP specific constant checks in code according to @dngulin's guide at #1440 (comment) via new build
net462-unity3d
Manually tested in Unity 2018.3.11f1 in editor, WebGL, Windows (Mono), and Windows (IL2CPP).
Scraped together in a hurry. It compiles, tests passes for all builds including this one, deploys fine. Have tried following codebase structure as best I can. Please be brute' on things to fix for this PR and I will get on it.
This PR aims to resolve #1440
Edit: Newtonsoft.Json-for-Unity is now available as an UPM package
To make it more customizable for Unity and easier to use, I've provided a package delivered by Unity Package Manager containing the changes of this pull request. This new repo will be maintained and remain up-to-date, while this pull request will not be.
https://github.com/jilleJr/Newtonsoft.Json-for-Unity
See #2044 (comment)